#ifndef IMAGEENGINE_H
#define IMAGEENGINE_H

#include "mconfig.h"
#ifdef GUI_APPLICATION

#include "miodevice.h"
#include "guistructure.h"
#include "type_def.h"

class MApplication;
class MWindowManager;
class MImage;
class MPainter;

class MImageEngine : public MIODevice
{
	private:
		explicit MImageEngine(const MString &lcd_device);
		~MImageEngine();

	private:
		static MRect initialize(const MString &lcd_device);
		static MImageEngine *const uniqueObject();

	public:
		void drawPoint(const MPoint &point, const MColor &color);
		void drawLine(const MLine &line, const MColor &color);

	public:
		void drawRect(const MRect &rect, const MColor &color);
		void drawSolidRect(const MRect &rect, const MColor &color);
		void drawRect(const MBorderRect &rect, const MColor &bcolor);
		void drawRect(const MBorderRect &rect, const MColor &color, const MColor &bcolor);

	public:
		void drawCirc(const MCirc &circ, const MColor &color);
		void drawCirc(const MBorderCirc &circ, const MColor &bcolor);
		void drawCirc(const MBorderCirc &annu, const MColor &color, const MColor &bcolor);

	public:
		void showFont(const MRect &rect, const char *text, const MFont &font, const MColor &color);
		void drawPicture(const MRect &rect, const unsigned long *pictrue_matrix);
		void showPicture(const MRect &rect, const char *path);

	public:
		muint32 readPoint(const MPoint &point);
		void readRect(const MRect &rect, unsigned long *matrix_buffer);

	public:
		static void howToGetFontMatrix(void(*getFontMatrix)(const char *encoding, const char *typeface, int font_size, unsigned char *font_matrix, int matrix_size));
#ifdef FILE_SYSTEM_FAT32
		static void setFontLibraresPath(const char *path);
#endif

	private:
		M_DISABLE_COPY(MImageEngine)
		friend class MApplication;
		friend class MWindowManager;
		friend class MImage;
		friend class MPainter;
};


#endif //GUI_APPLICATION

#endif //IMAGEENGINE_H
